﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_DDHB : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        btnOK.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并提交么？" + "')== false) return false;");
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int checkValue = 0;
        DdhbInfo hb = new DdhbInfo();
        hb.Dday = DateTime.Now.ToString();
        string nowtime = DateTime.Now.ToShortTimeString().ToString();
        string time1 = "08:00:00";
        string time2 = "20:00:00";
        DateTime dt1 = Convert.ToDateTime(nowtime);
        DateTime dt2 = Convert.ToDateTime(time1);
        DateTime dt3 = Convert.ToDateTime(time2);
        if (DateTime.Compare(dt1, dt2) < 0 || DateTime.Compare(dt1, dt3) > 0)
        {
            hb.Banbie = "夜";
        }
        else
            hb.Banbie = "白";


        hb.Banzu = Session["用户信息.班组"].ToString();
        hb.Tianbao = Session["用户信息.姓名"].ToString();
        hb.Wb = txtWb.Text.ToString();
        hb.Sc = txtSc.Text.ToString();
        hb.Sb = txtSb.Text.ToString();
        hb.Zl = txtZl.Text.ToString();
        hb.Aq = txtAq.Text.ToString();
        hb.Num = BLLFactory.CreateDdhbBLL().AUTOID();
        checkValue = BLLFactory.CreateDdhbBLL().AddDdhb(hb);
        if (checkValue >= 1)
        {
            Response.Write(" <script   language=javascript> window.alert( ' 提交成功！ ');</script> ");
        }
        Response.Redirect("DDHBJL.aspx");

    }
    protected void btnRepeat_Click(object sender, EventArgs e)
    {
        
        txtWb.Text = "";
        txtSc.Text = "";
        txtSb.Text = "";
        txtZl.Text = "";
        txtAq.Text = "";

    }
}
